package 剑指offer;

public class _56数组中数字出现的次数I {
    public int[] singleNumbers(int[] nums) {
        int n = 0,m = 1,a = 0,b = 0;
        for(int num : nums){
            n ^= num;
        }
        while ((n & m) == 0){
            m = m<<1;
        }
        for(int num : nums){
            if((num & m) == 0){
                a ^= num;
            }else {
                b ^= num;
            }
        }
        return new int[]{a,b};
    }
}
